Method and system of adaptive reformatting of digital image

ABSTRACT

Method and system of adaptive reformatting of digital photos and document image. The method includes selecting a rule of calculation of function of value for a pixel depending on results of analyzing an image, generating a map of value and a map of history, changing a size of the image by adding/removing at least one found path by means of interpolation, and repeating generation of the maps of values and history and change of a size of the image until a demanded size of the image is received or a sum of path values exceeds a predetermined threshold.

CROSS-REFERENCE TO RELATED APPLICATIONS

This application claims priority under 35 U.S.C. §119 (a) from RussianPatent Application No. 2008100088, filed on Jan. 10, 2008, in theRussian Patent Office, and Korean Patent Application No.10-2008-116516,filed on Nov. 21, 2008, in the Korean Intellectual Property Office, thedisclosures of which are incorporated herein by reference in theirentireties.

BACKGROUND

1. Field of the Invention

The present general inventive concept relates to image processing, andmore particularly, to a method of changing size/format of a digitalimage which can be used in editing an image.

2. Description of the Related Art

The technologies and methods relating to known decisions in the field ofthe image processing include linear scaling, framing, reformatting(retargeting), seam carving, and retouching.

The scaling is generally used to reduce and blow up photos and also isthe base operation in processing images which is used at the operationsdemanding turn, distortion, affine transformations, deinterlacing, andincrease of a resolution by time for video sequences. In most cases, thescaling is based on interpolation that finds an intermediate value usingan available discrete set of known values.

Above all, the interpolation is used to generates a full-color imagefrom an interleave transfer sensor of a digital camera and a videocamera. At the present time, a set of various methods of interpolatingan image with various complexities and productivities is provided.

General methods, such as bicubic and bilinear, introduce undesirableartifacts in the image in the field of sharp changes of brightness.Typical artifacts include edge dentation and tailing appearing on theassumption of smoothness of the image, and Gibb's effect shown as aresult of exception of high frequency components of a spectrum of theimage.

Usually, the two dimensional interpolation is made up a series of onedimensional interpolations in mutually perpendicular directions. Forexample, U.S. Pat. No. 6,915,026 assumes increase of an image in twostages, i.e., preliminarily calculating and saving coefficients forinterpolation first in a vertical direction and then in a horizontaldirection. This method has disadvantage that all one dimensionalinterpolations are made in parallel to coordinate axes of the image andthe shown artifacts detect an underlying coordinate grid. Some methodassumes a preliminary low frequency filtration in a diagonal direction,but unfortunately, it worsens image quality. U.S. Pat. Nos. 5,719,967and 6,606,093 describe special methods for suppressing dentation ofedges in the image.

The solution described in U.S. Pat. No. 5,446,804 is based onpreliminary calculation of sub-pixel map of edges. For each interpolatedpixel, there are four nearest neighbors. If any one of next pixels isnot cut by edge from the others, a required value is calculated by a sumof these neighbors having weights. If the neighbors are laid on thedifferent sides from the edges, an intermediate value is calculated fora required pixel using two diagonal pixels lying on one side of the edgewhich is selected based on the map. The required value in a positionlying on the other side of a border is replaced with a value received byneighbors and lying on one side of the edge and a calculated size. Suchdecision allows receiving an image with a sharp border but containingdentate edges.

The methods listed below are to overcome the effect of dentate edges bynot using interpolation along the axes lying on coordinate gird and alsomaking two dimensional increase in a vertical direction and in ahorizontal direction. The first method described in article Li, X., andM. Orchard, “New Edge Directed Interpolation,” IEEE InternationalConference on Image Processing, Vancouver, September 2000, is based onthe assumption of existence of geometrical dualism between covariationsco variations of images with a low and high resolution. Protection ofedges on the image is caused by adaptability of values of coefficientsto interpolation of random directed edge step. This method is intendedto increase an image in 2 times. The interpolation includes twoprocesses. First, a pixel having coordinates (2i+1,2j+1) is calculatedusing a known value in a position (2i,2j). Then, the similar procedurewith turn of 45 degrees is made on the other pixels. Each pixel isrecognized as a linear combination of the nearest four neighbors and theproblem of calculation of coefficients of a linear combination is solvedby the method of the least square. This interpolation method providesacceptable results, except for area having a structure in whichassumption of geometrical dualism is not hold.

The second method described in article, Yu, X., Morse, B. and T.Sederberg, 2001, Image Reconstruction Using Data-DependentTriangulation”, IEEE Computer Graphics and Application, vol. 21 No.3,pp. 62-68, achieves a triangulation of a surface in consideration of abrightness value of point height above some zero level. Authors of thismethod construct a grid of the triangulation and restore an image linearinterpolation of intensity inside a triangle. This approach is based ona data dependent triangulation (DDT) method along with differentoptimization and criterion function. Accordingly, the triangulationprotects an edge (sharp change in brightness) and improves imagequality. However, the triangulation is iteratively performed and thus iscomplex in view of calculation.

Sometimes, increasing an image includes two stages. First, an unknownbrightness value is calculated and then a postprocessing of an image isperformed to increase sharpness of the image and improve the edge. Forexample, U.S. Pat. No.6,714,688 describes the postprocessing of theimage to increase sharpness. First, bilinear interpolation of an imageis performed and then a postprocessing of the image is performed using amoving window. The size of the window is detected from the degree bywhich the window increases. First, a low frequency filter is applied toan inner pixel of the window to select a high frequency component of theimage. After that, the high frequency components are summarized with lowfrequency components having some coefficients detected based on localbrightness characteristics. Then, the edges are additionally processedusing a special curve indicating change in brightness.

The method described in EP Patent Application No.1533899 relates tochanging a size of a digital image using interpolation along borders andadditional postprocessing. First, the image is enlarged in 2n times andthen is reduced to a required size. An additional postprocessing ofedges is performed. This method provides good results but is complex inview of calculation.

Also, methods of intellectual cropping or framing of an image (photo)are well known, which are intended to change a ratio of geometricalsizes (a ratio of sides) of the image, for example, a ratio of width toheight, by cropping bottom and/or top (left and/or right) parts of theimage. The term “intellectual” means that a copping of a photo isperformed based on analysis of its contents with the purpose to excludea cropping of an important object captured from a photo. Therequirements for change in a ratio of outer sides of the photo appear ona user of a digital camera who wishes to print the digital image. Thegeneral digital photo has a ratio of sides of 4:3, wherein a standardsheet of photographic paper has a ratio of sides of 3:2.

There are two approaches to the decision of problem of cropping of aphoto, not relating to the analysis of its contents. The first approachis that top and bottom edges of the photo are cropped in the proportionof 50% to 50% or 20% to 80%. Accordingly, if the height of the photo isreduced by 1 cm, horizontal stripes of 5 and 5 mm or 2 and 8 mm inheight are cut from the above and the bottom. In many cases, thisapproach does not cause a cropping of an important object in the photolocated at a center of the picture. However, if an object ofshooting—for example, a person—is close to the edge of the photo, thisapproach may cause cropping of parts of the face, the head, or the otherparts of the image of the person.

The other approach is to print a photo on a sheet having left and rightspaces, not to crop the photo. However, this approach has disadvantagethat an area of the sheet of the photographic paper is not completelyused.

A main problem in the automatic cropping task includes detection andsegmentation of a important object (objects) on the image. The method ofdetecting an important object is divided into two categories. The methodbased on processing of pixels is to select a small group of pixels orindividual pixels corresponding to parts of an object captured from aphoto. For example, a method of selecting edges belongs to such amethod. The method based on processing of an area is to select an areacorresponding to whole semantically significant objects on the image.

Currently, the automatic cropping task is researched only superficially.Software packages of processing an image in which a function of framinga photo is obviously based on selection of main objects of shooting arewell known to the authors.

The program XV (www.trilon.com/xv) has a function of automaticallycropping an image which is operated as follows:

1. Boundary lines and columns of the image (top and bottom lines andleftmost and rightmost columns) are selected.

2. Variation in brightness in selected lines and columns is detected.Homogeneous lines and columns in a half-tone image are cut completely.Lines and columns in a color image having a low value of spatial andspectral correlation are cut.

3. Operations 1 and 2 are repeated as many times as necessary.

Accordingly, the program cuts rather homogeneous areas on edges of theimage. It does not define the contents of the image as a whole. Inpractice, dark edges of a scanned image appearing due to misalignment oforiginal before the scanning are effectively deleted. Unacceptableresults often appear due to insufficient analysis of contents of astage.

In U.S. Pat. No. 5,978,519, a method of cropping an image based ondifference of intensity levels is considered. A typical image includesan area of homogeneous intensity and color and an area where intensityand color considerably vary. For example, a portrait usually containssharp brightness conversion from the main object to the background. Inthe above described method, the size of the image is reduced and itshares on non-overlapped blocks. An average value and a dispersion ofintensity for each block are calculated. A threshold is selected basedon distribution of the dispersion in blocks and all blocks havingdispersion above the threshold are marked as a interest area. Theinterest areas are then cut by limiting a rectangle.

It is necessary to note that the above method is effective only in thecase where an initial image contains an area where a level of intensityconsiderably varies and an area having a constant level of intensity. Itis expected that efficiency of the method will be compared with theprogram. This method differs from the program in that the programanalyzes uniformity of the image line by line, whereas this methodanalyzes the image block by block. However, both of the methods areinefficiently operated in an image having a non-uniform background.

The function of intellectual cropping of package “Microsoft DigitalImage Suite 2006” has an opportunity to detect a face from a portrait orfamily photo. The program provides some variants of cropping and thenthe user selects a necessary ratio of sides from a list of standardformat of print. Besides, the user sets the sizes of the image inpixels.

As a whole, almost all existing methods for cropping are developed forcertain types of images, including photos of human in a rather simplebackground, museum photos in which a selected object of shooting is inthe center of the image with a homogeneous background, and images ofmodeling stages with several main subjects of various painting and form.Some of these methods are not intended to initially process a certainimage, and efficiency of other methods developed using generalprinciples is shown only on a simple image.

U.S. Pat. No. 6,282,317 describes a method of detecting a main objectfrom an image. This method includes receiving a digital image,extracting areas of form and size corresponding to an object presentedon the image, grouping areas in larger areas corresponding to theobjects physically connected, extracting at least one structurallyselected feature and at least one semantically selected feature for eacharea, and estimating probability of that area corresponding to the mainobject for each selected area.

U.S. Pat. No. 6,654,506 described a method of framing a digital image,which includes: inputting a confidential card of the image, a value ineach point of this image describing importance of information in acorresponding point of the image; selecting a scaling factor and awindow of cropping, clustering areas of the confidential card fordefinition of areas of a background, a secondary area, and areas of amain object, positioning the window of cropping in the field of the mainobject so as to make the sum of values of trust inside the windowmaximal; and cropping the image on the borders of the window ofcropping.

The laid-open US patent application No. 2002/0191861 describes automaticand semi-automatic framing of images, and, in particular, a device and amethod of capturing and framing images using an electronic camera. Theelectronic device for framing the images includes tools for processingthe image, in particular, an electronic processor and a programmedequipment and/or a software for processing of images. The deviceidentifies features of a composition of the image and finds a similarfeature from a number of predetermined features stored in the device,for each selected feature. Then one or several predetermined compositionrules, connected with stored features, are selected. The device definesone or several suitable borders for framing, by applying one or severalselected composition rules.

A method of controlling fragments of the photo is described in thepatent application RU 2005137049. According to this reference, fragmentscan be received by means of operations of mirror display/duplication oflateral parts of an image.

A laid-open US application No. 2007/0025637 has been partially publishedearlier in Setlur et al, “Automatic Image Retargeting” ACM InternationalConference on Mobile and Ubiquitous Multimedia (MUM) 2005, v. 154, pp.59-68. Authors have described a new approach for automatic reformattingof images (automatic image retargeting), keeping proportions of theimportant objects of the image at reduction of the sizes of the image.For an initial image and the adjusted format, this method executesfollowing actions. First of all, the initial image is segmented onregions based on analysis of distribution of color and brightnesscharacteristics of the image. Then, the map of importance ofpixels/regions of the initial image is created based on the model ofhuman sight and methods of detecting of human faces from digital images.If the adjusted format contains all of the important regions, then theimage is framed. Otherwise, the important regions are excluded from theimage, which is scaled according to the adjusted format. Then, theimportant regions are inserted into the modified image, according to adegree of importance and topology. The technology, described above,allows minimizing loss of details of the image and lowering distortions,which are caused by traditional approaches. Also it is necessary tonote, that this method makes the important regions closer to each other,keeping their topology.

In the article by Shai Avidan, Ariel Shamir, “Seam Carving forContent-Aware Image Resizing ACM Transactions on Graphics, Volume 26,Number 3, SIGGRAPH 2007”, an effective procedure of changing the sizesof the image is described, which considers not only geometricalrestrictions, but also the contents of the image. Also, concept anddefinition of the operator seams scaling (seam carving) are introduced,which is used for reduction and increasing of the image taking intoaccount its content. The seam represents a coherent optimum path frompixels of the image, wherein the optimality is defined using a functionof energy of the image. Numerous removal or addition of seams allowsachieving change of a format/size of the image.

Recently, there is continuous growth of amount of digital photos andimages of documents, which are received and displayed by means ofvarious devices, such as digital cameras, mobile phones, televisiondevices (including devices with high definition), etc. However, theratio of the geometrical sizes (format) of the digital image does notalways correspond to the ratio of the geometrical sizes of area fordisplay. For example, the digital picture has the ratio of the sides of4:3, and the print is executed on a paper with the ratio of the sides of3:2. The set of methods is offered for matching the ratio of the sidesof a digital picture and area for display. Following methods are mostknown: scaling, framing and adaptive addition or duplication of parts ofthe image. These methods are widespread because of their rather simplerealizations. However, existing approaches possess two essentialdisadvantages: reduction of a viewing area due to framing or occurrenceof effects of “the stretched image” or “the compressed image”.

Algorithms which are constructed based on idea of scaling of the image,change proportions of objects according to change of the ratio of thesides of the image. Technologies of framing are accompanied by losses ofparts of the image, and technologies of addition or duplication of partsof the image introduce an image nonexistent in a reality parts andbecause of it the resulting image is looked artificially in some cases.

Known technical decisions-analogues do not provide adaptive reformattingof digital images depending on their contents. However, results ofreformatting strongly depend on the content of the image, and specialsteps for prevention of changes of proportions and the sizes of the mostimportant objects on the image are required. The most significantobjects on digital photos are images of human, and the most significantobjects on images of documents are text inscriptions.

Besides, known analogues in the field of reformatting possess essentialrestrictions: there is a change of proportions of objects or there arerestrictions on the size of resulting image.

In the known analogues, describing technical decisions on change of aformat of digital images, technologies of framing and duplication ofimage elements are used, which are based on operations ofaddition/removal of group of pixels. The group of pixels represents ahorizontal or vertical line from coherent pixels. However, it isdesirable that removal or addition of groups of pixels can be madebasically on borders of images and/or one or more objects located nearthe borders of the image are not distorted.

SUMMARY

The present general inventive concept provides development of a methodand a system of reformatting without lacks, inherent to theabove-mentioned analogues and prototype. The present general inventiveconcept also provides a method of optimum removal/addition of group ofpixels. The group of pixels is understood as a coherent path which canshape various forms, and not just only horizontal or vertical. This pathcan be in any place of the image depending on a location of one or moreobjects, which provides preservation of their proportions and the sizes.The present general inventive concept also provides a new decision toconsider an opportunity of reformatting images received by means ofvarious devices and systems, such as copy devices, faxes, printers,cameras, Internet-browsers, etc. The present general inventive conceptalso provides a system and method to prevent changes of proportions andsizes of the objects, thereby considerably improving quality ofreformatted images.

The present general inventive concept also provides development ofimproved method and system of reformatting of a digital image.

Additional aspects and utilities of the present general inventiveconcept will be set forth in part in the description which follows and,in part, will be obvious from the description, or may be learned bypractice of the general inventive concept.

The foregoing and/or other aspects and utilities of the present generalinventive concept may be achieved by providing a method of adaptivereformatting of digital photos and document images, including selectinga rule of calculation of function of value for pixel depending onresults of the analysis of the image, generating maps of values andhistory, changing a size of the image by adding/removing at least onefound path using interpolation.

Both of horizontal and vertical paths may be used. The horizontal pathmay be a chain of the connected pixels where an initial pixel of thehorizontal path is on the left border of the image, a final pixel of thehorizontal path is on the right border of the image, and the quantity ofpixels in the horizontal path is equal to the width of the image ofpixels, whereas the vertical path may be a chain of the connected pixelswhere an initial pixel of the vertical path is on the top border of theimage, a final pixel of the vertical path is on the bottom border of theimage, and the quantity of pixels in the vertical path is equal to theheight of the image of pixels. Search of a path may be executed by meansof minimization of a sum of values of pixels of a path. The method mayfurther include repeating generation of the maps of values and historyand change of the size of the image until a desired size of the image isachieved or the sum of path values exceeds a predetermined threshold.

Detecting a face image of people may be used when a rule of calculationof function of value is selected.

A detector of city stages and architectural constructions may be usedwhen a rule of calculation of function of value is selected.

A high-frequency filter may be used when the map of values is generated.

A function describing colors typical for the human skin may be used whenthe map of values is generated.

The changing a size of the image may increase the image by adding atleast one path by defining a path with a minimum sum of values, addingnew pixels next to pixels of the path using interpolation by severalnearest pixels, weakening values in the map of history and updating themap of history, and updating values in the map of values.

The changing a size of the image may reduce the image by removing atleast one path from the image by defining a path with a minimum sum ofvalues, removing pixels of the path and correcting values of the pixels,thereby bordering with the pixels of the removed path, weakening valuesin the map of history and updating the map of history, and updatingvalues in the map of values.

The weakening values in the map of history may use the followingequation:

H(i,j)=H(i,j)⁻¹−C,

where H(i,j) denotes a value of element of the map of history,H(i,j)^(−i) denotes a value of element of the map of history beforeweakening, and C denotes a predetermined constant.

The foregoing and/or other aspects and utilities of the present generalinventive concept may be also achieved by providing a system of adaptivereformatting of digital photos, including a module to select a rule ofcalculation of function of value for a pixel, a generator of maps ofvalues and history, a module to analyze the map of values and select apath, a module to add a path to an image, a module to remove a path froman image, a scaling module, a module to weaken the map of history, and amodule to update the map of values.

An output of the module to select a rule of calculation of function ofvalues for a pixel is connected with an input of the generator of mapsof values and history, and also with an input of the module to updatethe map of values, an output of the generator of maps of values andhistory is connected with an input of the module to analyze the map ofvalues and select a path, an output of the module to analyze the map ofvalues and select a path is connected with inputs of the module to add apath to the image, of the module to remove a path from the image, and ofthe scaling module, outputs of the module to add a path to the image andof the module to remove a path from the image are connected with aninput of the module to weaken the map of history, an output of themodule to weaken the map of history is connected with an input of themodule to update the map of values, and an output of the module toupdate the map of values is connected with an input of the module toanalyze the map of values and select a path.

The module to select a rule of calculation of function of value for apixel selects a rule of calculation of function of value for each pixelfrom a set of predetermined rules depending on information contained inthe image. The generator of maps of values and history generates aninitial map of values and an initial map of history, using the selectedrule. The module to analyze the map of values and select a pathdetermines at least one horizontal path from connected pixels, where aninitial pixel of a path is on the left border of the image, a finalpixel of the path is on the right border of the image, and the quantityof pixels in the path is equal to the width of the image of pixels, andalso determines at least one vertical path from connected pixels, wherean initial pixel of a path is on the top border of the image, a finalpixel of the path is on the bottom border of the image, and the quantityof pixels in a path is equal to the height of the image of pixels.

If a sum of pixel values of all found paths is greater than or equal toa predetermined threshold, the image is transferred to the scalingmodule, and if the sum is less than the predetermined value, the imageand the maps of values and history are transferred to the module to adda path to the image or the module to remove a path from the imagedepending on a current and required ratio of the sides of the image. Themodule to add a path to the image increases the current image by addingthe least one found path to the image using interpolation for severalnearest pixels. The module to remove a path from the image reduces thecurrent image by removing the least one found path from the image. Themodule to weaken the map of history reduces the values in the map ofhistory, which correspond to environment of pixels of paths removed oradded earlier. The module to update the map of value recalculates a mapof values, using the previously selected rule and map of history.

The reformatting image differs from the initial image in its form, sizesand/or a format (the ratio of the geometrical sizes of the digitalimage), and the size and proportions of the most important objects onthe image are maintained. In the claimed invention, the method andsystem of adaptive reformatting of digital images by removal and/oraddition of the least important pixels of the image are offered.

The foregoing and/or other aspects and utilities of the present generalinventive concept may be also achieved by providing an image formingapparatus, including a module to select a rule of calculation offunction of value for a pixel from a set of predetermined rulesdepending on information contained in an image, a generator to generatesan initial map of values and an initial map of history, using theselected rule, a module to search at least one horizontal or verticalpath with a minimum sum of values by analyzing the initial map ofvalues, and a module to change a size of the image by adding or removinga path to or from the image using the searched path.

The horizontal path may be a chain of pixels where an initial pixel ison the left border of the image, a final pixel is on the right border ofthe image, and the quantity of pixels is equal to the width of the imageof pixels, and the vertical path may be a chain of pixels where aninitial pixel is on the top border of the image, a final pixel is on thebottom border of the image, and the quantity of pixels is equal to theheight of the image of pixels.

The image forming apparatus may further include a module to scale theimage if a sum of pixel values of the paths is greater than or equal toa predetermined threshold.

The module to change a size of the image may include a module to add thesearched path to the image, and a module to remove the searched pathfrom the image.

The module to add the searched path may add at least one path by addingnew pixels next to pixels of the searched path using interpolation byseveral nearest pixels, by weakening values in the map of history andupdating the map of history, and updating values in the map of values.

The module to remove the searched path may remove at least one path bydefining a path with a minimum sum of values, removing pixels of thepath and correcting values of the pixels, thereby bordering with thepixels of the removed path, weakening values in the map of history andupdating the map of history, and updating values in the map of value.

The module to select a rule of calculation of function of value may usedetecting a face image of people.

The module to select a rule of calculation of function of value may usedetecting city stages and architectural constructions.

The generator may use a high frequency filter.

The generator may use a function describing colors typical for humanskin.

In order to preserve coherence and form of the digital image, at leastone group of the least important coherent pixels in a vertical orhorizontal direction is calculated on each operation of reformatting.The coherent group of pixels will be called “path” hereinafter in thetext. On each operation of reformatting, the calculated path is removedor added to a new image with the changed geometrical sizes.Subsequently, the received image is used as an initial image on thesubsequent operations of reformatting. This process is repeated untilthe image has necessary sizes/formats.

A special function of value is used to calculate degree of importance ofeach pixel of the image. It is necessary to note that this functionconsiderably depends on the content and on the nature of image (photo,document image, facsimile image, etc.). This function can be selectedfrom a predetermined set of possible functions by a method includingdefining content of the image and corresponding function of value, whichdescribes in the best way importance of pixels for the given class ofimages, by a user, selecting a function of value interactively, and bythe system and the device which use the method of reformatting accordingto the formula of the present invention, defining and adjusting thefunction of value.

For the current image, the map of values is calculated after selectionof the function of value has been executed. The map of values representsan array with a dimension equivalent to a dimension of a processableimage. Each element of the map of values sets a numerical value ofdegree of importance of the corresponding pixel of the image. In orderto find an optimum coherent path which contains the least importantpixels, a weighed graph with directivity is constructed. Due to thegraph, the optimizing problem of search of a path with a minimum sum ofvalues is solved. Graph junctions correspond to pixels of the image, andweight coefficients are assigned to graph edges by means of the map ofvalues. This search is made in vertical and horizontal directions forcalculation of horizontal and vertical paths accordingly. The decisionof set optimization problem is made by means of algorithms and methodsof dynamic programming and is described in more detail below. The paths,received thus, are removed or added to the image for change of thesize/format of the image.

The method of reformatting described above can be used to reduce one orseveral sides of the image by simply excluding the found path of theimage. However, there are certain restrictions for operation of increaseof the image. It is obvious that after a finding and addition of anoptimum path on the image there is the great chance of a finding andduplication of the same path of the subsequent iterations ofreformatting. This results in effect of extension of the image andduplication of the same path on all iterations of reformatting. The mapof history is used to prevent such situation and to remove restrictionson the size of the received image during increase of the images. Eachelement of the map of history represents an additional degree ofimportance for each pixel of the image. The degree of importance doesnot depend from the image and depends on the added/removed paths on theprevious iterations.

The map of history is initialized in the beginning of reformatting. Inparticular, a minimum value is set to all elements of the map of historyduring operation of increase. On each iteration of reformatting, thesize of the map of history and the processable image are equal to eachother. During operation of increase, the found path is added to both ofthe processable image and the map of history. The maximum value is setto elements of the map of history, which belong to the found method andits added copy. Such setting allows avoiding undesirable duplication ofthe same paths during increase, as the added path will have the largesum of values on following iteration and will not be selected.

During reformatting, the map of history can be considerably filled withelements with the maximum values, and a process of searching an optimumpath seems to be impossible. In order to prevent such situation, aprocedure of weakening the map of history is performed, which reducesvalues of elements of the map of history by time. Thus, oversaturationof the map of history by elements with the maximum values is notsupposed.

A card of history is also used to accumulate paths which are needed tobe excluded from the image in operation of reduction. Such approachseems to be much more effective than approach of removal of paths oneach iteration. In addition, using of the map of history is not limitedto operations of increase and reduction of images. It can be used forremoval or saving of the objects, chosen by the user, by assigning smallor great values to corresponding elements of the map of history.

A method of adaptive reformatting of digital photos and document imagesincludes initializing the map of history, selecting a function of value,calculating the map of value, weakening the map of history, searching anoptimum path, updating (operation of removal/addition of the path) theprocessable image using at least one calculated path, updating the mapof history using the calculated path/paths, and repeating theabove-described operations until a necessary size/format of the image isreceived.

The foregoing and/or other aspects and utilities of the present generalinventive concept may be also achieved by providing a method of an imageforming apparatus, the method including selecting a rule of calculationof function of value for a pixel from a set of predetermined rulesdepending on information contained in an image, generating an initialmap of values and an initial map of history, using the selected rule,searching at least one horizontal or vertical path with a minimum sum ofvalues by analyzing an initial map of values, and changing a size of theimage by adding or removing the path to or from the image using thesearched path.

The foregoing and/or other aspects and utilities of the present generalinventive concept may be also achieved by providing a computer readablemedium to contain computer-readable codes as a program to perform amethod of reformatting an image in an image processing apparatus, themethod including selecting a rule of calculation of function of valuefor a pixel from a set of predetermined rules depending on informationcontained in an image, generating an initial map of values and aninitial map of history, using the selected rule, searching at least onehorizontal or vertical path with a minimum sum of values by analyzing aninitial map of values, and changing a size of the image by adding orremoving the path to or from the image using the searched path.

The foregoing and/or other aspects and utilities of the present generalinventive concept may be also achieved by providing a system to adjustan image, including a first module to receive a signal representing animage having a plurality of pixels disposed on a plurality of paths andto select one of the paths according to a relative characteristic of thepaths, and a second module to add or deleted the selected path togenerate a signal representing a second image different from the image.

The second module may adjust values of pixels disposed adjacent to thepixels of the added or deleted path.

The system may further include a unit configured to receive at least oneof the signal and the second signal to be displayed or printed.

BRIEF DESCRIPTION OF THE DRAWINGS

These and/or other aspects and utilities of the present generalinventive concept will become more apparent and more readily appreciatedfrom the following description of the embodiments, taken in conjunctionwith the accompanying drawings of which:

FIG. 1 is a flowchart illustrating a method of adaptive reformatting ofdigital photos and document images according to an exemplary embodimentof the present general inventive concept;

FIG. 2 is a flowchart illustrating a process of analyzing the image inselecting a rule of calculation of function of value for a pixel;

FIG. 3 is a flowchart illustrating a process of increasing the image byadding a path;

FIG. 4 is a flowchart illustrating a process of reducing the image byremoving a path;

FIG. 5 is a block diagram illustrating a system according to anexemplary embodiment of the present general inventive concept;

FIG. 6 is a schematic view illustrating borders of the image used tosearch for an optimum path;

FIG. 7 is a schematic view illustrating a model of a graph for decisionof optimization problem of search of the optimum path;

FIG. 8 is a schematic view illustrating assigning weights to graphedges;

FIG. 9 is a schematic view illustrating reducing the image duringreformatting;

FIG. 10 is a schematic view illustrating increasing the image duringreformatting;

FIG. 11 is a schematic view updating and weakening a map of history;

FIG. 12 is a block diagram illustrating an interactive system forreformatting;

FIG. 13 is a block diagram illustrating a reformatting system forcopiers;

FIG. 14 is a block diagram illustrating a reformatting system forfacsimile devices;

FIG. 15 is a block diagram illustrating a reformatting system for HTMLdocuments;

FIGS. 16 to 19 are views illustrating examples of reformatted images ofdocuments;

FIG. 18 is a view illustrating examples of reformatting of HTMLdocument; and

FIGS. 20 to 23 are views illustrating examples of using a system forreformatting a photo to transform an initial format of 4:3 to a formatof 3:2.

DETAILED DESCRIPTION OF THE EMBODIMENTS

Reference will now be made in detail to the embodiments of the presentgeneral inventive concept, examples of which are illustrated in theaccompanying drawings, wherein like reference numerals refer to the likeelements throughout. The embodiments are described below in order toexplain the present general inventive concept by referring to thefigures.

The present general inventive concept will be described in detail usinggraphic materials.

The present general inventive concept relates to a system and/or amethod to change a size of an image by adding or removing pixels whichhave low importance (self-descriptiveness) in the image. The importanceof each pixel is determined by a function of values. The kind of thisfunction depends on information contained in the image and determinesresult of reformatting.

FIG. 1 is a flowchart illustrating a method of adaptive reformatting ofan image, such as a digital photo and a document image, according to anexemplary embodiment of the present general inventive concept. Inoperation S101, a rule of calculation of a function of values for pixelsis determined according to a result of analyzing the image. The rule ofcalculation of a function of values is selected from a predetermined setof rules automatically or interactively.

The value of a pixel may be a value representing a level of acharacteristic of the pixel, such as brightness, chrominance, colorcomponent, etc. The value may be a relative characteristic with respectto a reference or a relative position of the image. The image mayinclude one or more pixels disposed on a path. The path may be ahorizontal or vertical path on which a plurality of pixels are disposed.It is possible that the path may be a path having an angle with thehorizontal or vertical path. It is also possible that the path may belinear or non-linear depending on a characteristic of the image. It isalso possible that the path may be a path including a combination of atleast two of the horizontal path, the vertical path, and the path havingan angle with at least one of the horizontal path and the vertical path.

When the rule of calculation is selected manually or interactively, acontroller of a system (i.e., image processing apparatus) generates asignal representing an interface to perform the method of adaptivelyreformatting an image according to the present general inventiveconcept. The generated interface is displayed on a screen of a displayunit connectable to the image processing apparatus or installed on ahousing body of the image processing apparatus. The generated interfacemay include one or more rules of calculation, and a user can select oneof the displayed rules of calculation using an input unit connectable tothe image processing apparatus or installed on the image processingapparatus. When the screen is a touch screen, the user may select therule of calculation by contacting a corresponding portion of the screen.The interface may include at least one of the predetermined rules ofcalculation, the image, and instruction to guide a user to select therule.

In operation S102, maps of values and history are generated according tothe selected rule of calculation. In operation S103, the image isincreased or reduced depending on an initial size of the image and ademanded size of another image adjusted from the image. The increase orreduction of the image is performed by means for adding at least onefound horizontal or vertical path to the image using interpolation, orby means for removing at least one found horizontal or vertical pathfrom the image. The horizontal pixel is a chain of pixels, which aredisposed on a path. When the path is a horizontal path, an initial pixelof the horizontal path is on the left border of the image, a final pixelof the horizontal path is on the right border of the image, and thequantity of pixels in the horizontal path is equal to a width of theimage of pixels. The vertical path is a chain of pixels, which aredisposed on a path. When the path is a vertical path, an initial pixelof the vertical path is on the top border of the image, a final pixel ofthe vertical path is on the bottom border of the image, and the quantityof pixels in the vertical path is equal to a height of the image ofpixels.

Here, the chain of pixels may be a chain of connected pixels which arecontinuously disposed along the path. However, it is possible that thechain of connected pixels may be not continuously disposed. It is alsopossible that the quantity of the pixels in the horizontal or verticalpath may not be equal to the width or height of the image but differentfrom the width or height of the image.

Search for the path is based on minimization of a sum of values ofpixels of the corresponding path. If a desired size of the image isreached in operation S104, the method finishes the operation. Otherwise,maps of values and histories are generated according to the sum inoperation S102, and also, the operation S103 of increasing or reducingthe image is repeated until the demanded size of the image will bereached or the sum of values of the path will exceed a predeterminedthreshold.

As a whole, a function of values (F) is defined by the followingequation:

F(I,x,y)=grad(I,x,y)+POI(I,x,y),   [Equation 1]

wherein I denotes a processable image, x,y denote coordinates of pixels,grad(I,x,y) denotes a function of calculation of gradient for pixelswith coordinates (x,y), and POI denotes a function of detection of aspecific pixel.

The function grad(I,x,y) sets general importance of each pixel inhigh-frequency borders of the image. Linear and nonlinear high-frequencyfilters, such as Sobel's operator, a module of the gradient of colors,horizontal and vertical final differences, Laplacian-gaussian can beused as a given function. However, not only pixels on high-frequencyborders are important on the digital image. The function POI adds avalue uniformly, except for significant areas, such as a skin of thehuman, fragments of architectural constructions and so on.

FIG. 2 is a flowchart illustrating a process of analyzing an image inselecting a rule of calculation of a function of values for pixels. Inoperation S201, detecting presence of the human on the image isperformed. In the present general inventive concept, the detecting isrealized using a function describing colors as a characteristic such asa human skin. The function may be one or function described, forexample, in article G. Gomez, E. Morales, Automatic feature constructionand a simple rule induction algorithm for skin detection, proc. of theICML Workshop on Machine Learning in Computer Vision, pp. 31-38, 2002.If the pixels representing colors having a characteristic such as ahuman skin occupy a significant area, it is considered that there is ahuman on the image, and, in operation S203, a rule of calculation offunction of values for pixels is selected such that larger values areassigned to pixels, which presumably concern to the image of the human.In operation S205, a detector of city stages and architecturalconstructions is used. The detector may be one of detectors, forexample, described in article N. Serrano, A. Savakis, J. Luo, Acomputationally efficient approach to indoor/outdoor sceneclassification, Proc. International Conference on Pattern Recognition,2002, 146-149; in the patent application of the Russian Federation2006136861 and in report A. Vailaya, A. Jain, J. Z. Hong, On imageclassification: city vs. landscape, Proc. IEEE Workshop on Content-BasedAccess of Image and Video Libraries, pp. 3-8, 1998. If there arearchitectural constructions on the image in operation 203, a rule ofcalculation of function of values for pixel is selected in operationS206 such that larger values are assigned to pixels, which correspond tolengthy direct lines. In operation S207, a high-frequency filter isselected to calculate of value of each pixel. The detectors may notdepend from each other and can be used in any sequence.

FIG. 3 is a flowchart illustrating a process of increasing an image byadding a path. In operation S301, at least one path with the minimum sumof values is defined. It is possible to simultaneously process aplurality of paths in parallel in a single process. In operation S302, anew pixel is added next to pixels of the path using interpolation by aplurality of nearest pixels. In operation S303, a card of history isupdated by adding a value corresponding to the path pixel and weakeningvalues of pixels which were given earlier in the original (initialimage). In operation S304, values are updated in the map of values byapplying the image of the function of calculation of values and the mapof history to pixels.

Here, “weakening” represents “adjusting,” “corrected” or “reducing” thevalue of the respective pixels. The respective pixels may be pixelsdisposed adjacent to the path which has been added to or deleted fromthe image. Therefore, when the pixel values are weakened, the value ofpixels are adjusted, reduced, or increased to compensate for at leastone defect occurring due to the added or deleted pixels of the path inthe adjusted image.

The card of history may be data representing at least one of the image,the adjusted image, and changes of the path, pixels of the path, andvalues of the pixels. The data may be stored in a memory unitconnectable to the image processing apparatus or mounted in the imageprocessing apparatus.

FIG. 4 is a flowchart illustrating a process of reducing an image byremoving a path. In operation S401, at least one path having a minimumsum of values is defined. It is possible to simultaneously process aplurality of paths in parallel for one iteration. In operation S402,pixels of the path are deleted and values of pixels are corrected suchthat the image is bordered with pixels of the removed path. In operationS403, the map of history is updated by deleting elements correspondingto pixels of the path from the map, adding values, corresponding topixels, next to pixels of the path, to it and weakening values whichwere in the given map earlier. In operation S404, values in the map ofvalues are updated by applying the image of function of calculation ofvalues and the map of history to pixels.

FIG. 5 is a block diagram illustrating a system of adaptive reformattingof an image, such as a digital photo and a document image. The systemmay be an image processing apparatus. The system includes a module 501to select the rule of calculation of function of value for pixelaccording to a signal received from an external device connectable tothe system or an internal device mounted in the system, a generator 502to generate or store maps of values and history, a module 503 to analyzethe map of values and select a path, a scaling module 504, a module 505to remove a path from the image, a module 506 to add a path to theimage, a module 507 to weaken the map of history, and a module 508 toupdate the map of values. The module may represent a unit configured toperform its own operation.

The output of the module 501 to select the rule of calculation offunction of value for pixel is connected with an input of the generator502 of maps of values and history, and also with an input of the module508 to update the map of values. The output of the generator 502 of mapsof values and history is connected with an input of the module 503 toanalyze the map of values and select a path. The output of the module503 to analyze the map of values and select a path is connected withinputs of the module 506 to add a path to the image, the module 505 toremove a path from the image and the scaling module 504. The output ofthe module 506 to add a path to the image and the module 505 to remove apath from the image is connected with an input of the module 507 toweaken the map of history. The output of the module 507 to weaken themap of history is connected with an input of the module 508 to updatethe map of values. The output of the module 508 to update the map ofvalues is connected with an input of the module 503 to analyze the mapof values and select a path.

The module 501 to select the rule of calculation of function of valuefor pixel selects the rule of calculation of function of value for eachpixel of the image from a predetermined set, depending on informationcontained in the image. The generator 502 of maps of values and historygenerates initial maps of values and history, using the selected rule.The module 503 to analyze the map of values and select a path defines atleast one horizontal path from the pixels where the initial pixel of thepath is on the left border of the image, the final pixel of the path ison the right border of the image, and the quantity of pixels in path isequal to width of the image of pixels, and also defines at least onevertical path from the pixels where the initial pixel of the path is onthe top border of the image, the final pixel of the path is on thebottom border of the image, and the quantity of pixels in path is equalto height of the image in pixels. If a sum of values of pixels of allfound paths is greater than or equal to a predetermined threshold, theimage is transferred to the scaling module 504, and if the sum of valuesof pixels of all found paths is less than the predetermined threshold,this module transfers the image to the module 506 to add a path to theimage or to the module 505 to remove a path from the image, depending ona current and demanded ratio of the sides of the image.

The module 506 to add a path to the image increase the current image byadding the at least one found path to the image using interpolation byseveral nearest pixels. The module 505 to remove a path from the imagereduces the current image by removing at least one found path from theimage. The module 507 to weaken the map of history reduces values in themap of history, which correspond to vicinities of pixels of pathsremoved or added earlier. The module 508 to update the map of valuesrecalculates the map of value, using earlier selected rule and the mapof history.

Although the operations of the system have been described above, thepresent general inventive concept is not limited thereto. The method mayfurther include one or more operations of calculating an optimum pathand the map of history and processing change of the size/format of theimage are described below in details.

The operation of calculating an optimum path is to search a connectedpath of pixels in a vertical or horizontal direction between oppositeborders of the image. FIG. 6 illustrates a top border 601 and a bottomborder 602 of the image, and also illustrates a left border 603 and aright border 604. Search for a vertical path is performed between thetop border 601 and the bottom border 602, and search for a horizontalpath is performed between the left border 603 and the right border 604.

For each pixel belonging to the top border 601 or the left border 603, aweighed graph with a directivity is constructed as illustrated in FIG.7. Each pixel of the image is associated with a corresponding graphjunction. Each graph junction has three edges with set weight factors.The quantity of edges is not limited rigidly. The present invention isapplicable to a graph with 5 or more edges starting from each graphjunction. However, if a graph with edges more than 3 is used,computation complexity of algorithm of search of an optimum pathincreases, and connectivity of objects on the image decreases, whichresults in reduction of quality of received results.

An weight coefficient w (i,j,k) is assigned to each edge, wherein thecoefficient is equal to corresponding value of the map of values pluscorresponding value of an element of the map of history according toassigning weights illustrated in FIG. 8. The weight coefficient isassigned to each edge, which is starting from a current graph junction,under following equation:

w(i,j,1)=a(i−1,j+1)+h(i−1,j+1)

w(i,j,2)=a(i,j+1)+h(i,j+1)

w(i,j,3)=a(i+1,j+1)+h(i+1,j+1)′

where i,j denote corresponding coordinates of graph junction, k denotesthe number of edges, a( ) denotes an element corresponding to map ofvalues, and h( ) denotes an element corresponding to the map of history.

In addition to the above-describe method of adjusting an image by addingor deleting the selected pixels of a selected path, in an operation ofsearching for an optimum path between borders of images on the setgraph, the optimality is defined as search for the connected path with aminimum sum of values along this path. The sum l(μ) of values of thepath μ consisting of sequence of edges a₁, a₂. . . a_(n), is equal tothe sum of weight coefficients along μ and is defined by the followingequation:

$\begin{matrix}{{l(\mu)} = {\sum\limits_{i = 1}^{n}{w(i)}}} & \left\lbrack {{Equation}\mspace{14mu} 3} \right\rbrack\end{matrix}$

The optimum path can be effectively searched by algorithms of search onthe graph and methods of dynamic programming The algorithms may be wellknown. Therefore, detailed descriptions thereof will be omitted.

As illustrated in FIG. 9, found optimum path 901 divides a processableimage 906 into two parts 902 with pixels indicated by white circles and903 with pixels indicated by white rectangles. A reduced image 907includes two parts 902a and 903a by deleting pixels of the path 901.Groups of pixels 905 and 904, which include the pixels locating inimmediate proximity from the pixels belonging to the found optimum path901, can be processed in addition by means of procedure of interpolationfor smoothing and compensation of the possible defects, during anoperation of deleting the path 901 from the image.

The similar method is used in operation of increase (see FIG. 10). Afound optimum path 1001 divides a processable image 1004 into two parts1002 and 1003. An increased image 1005 consists of two parts 1002 a and1003 a which are equivalent to the corresponding parts 1002 and 1003 ofthe image. The found optimum path 1001 forms or is replaced with copies1001 a and 1001 b by adding pixels duplicated along the found path tothe image 1005. With respect to pixels belonging to the copies 1001 aand 1001 b of the optimum pat, an additional interpolation procedure isperformed.

The map of history is also updated when increasing the image is repeatedand is also updated according to the found optimum path. FIG. 11illustrates examples of updating 1103 and weakening (adjusting,correcting, reducing, or increasing) 1105 of the map of history. The mapof history 1102 and the found optimum path 1101 are used to receive theincreased map of history 1104. The maximum values are assigned toelements of the map of history, which belong to the found optimum path1101 a and its duplicated copy 1101 b. The weakened map of history 1106represents the increased map of history 1104 of which elementscorresponding to values (changes) of corresponding pixels are reduced(adjusted, corrected, or increased) by a predetermined value. Thefollowing function is used in this example

H(i,j)=H(i,j)⁻¹ −C  [Equation 4]

where H(i,j) denotes a value of element of weakened map of history,H(i,j)^(−i) denotes a value of element of map of history before theprocedure of weakening, and C denotes a predetermined constant value.Use of other functions of weakening is also possible and the presentgeneral inventive concept is not limited to the functioning ofweakening, resulted above.

The system of adaptive reformatting of digital images according to theexemplary embodiment of the present invention can operate completely inan automatic mode, when a demanded size/format of resulting image isknown. According to the present general inventive concept, the systemmay be an interactive system of reformatting in the case where a finalsize/format of the image is unknown. As illustrated in FIG. 12, aninitial digital image 1201 is reformatted to an image 1203 with a newsize/format by the adaptive system of reformatting 1202. The size/formatof the resulting image is controlled by a user 1205 in an interactivemode by generating one or more user signals 1206, which enter on aninput of system of reformatting. Intermediate/final results ofreformatting 1203 is displayed on a display device 1204 and perceived bythe user 1205. The user 1205 decides based on the intermediate resultdisplayed on the display device 1204, and generates new control signalsto receive a desirable resulting image.

The system may be an image forming apparatus, such as a copier (see FIG.13). A paper document 1301 is scanned by a scanning device 1302.Received digital representation of the paper document is reformatted bya system of reformatting 1303, according to incoming operating signals1304 coming from a user and/or a copier. A reformatted digital image isprinted on a printing medium and/or displayed on a corresponding displaydevice 1305. Thus, a paper reformatted document 1306 is the result.

The image forming apparatus may be facsimile devices to reformat one ormore facsimile documents.

As illustrated in FIG. 14, the facsimile device may include a scanner1402 to scan a document or a picture to generate a signal representingan image of the scanned document, a modem 1403 to transmit the signalthrough a communication channel 1404 which is a wired or wirelesscommunication line, a modem 1405 to receive the signal through thecommunication channel 1404, a controller (reformatting system) 1406 toreformat the image according to the present general inventive conceptand selectively according to a selection of a control signal of acontrol signal unit 1409, a functional unit to display the image, thereformatted image or data representing the image and the reformattedimage, and to perform an image forming operation to form the image orreformatted image on a printing medium as a reformatted paper document1408.

The system may be a system of reformatting of HTML documents isillustrated in FIG. 15. The HTML documents is a document having a sizeof the HTML document which is set by a developer of the system. A<<scroll bars>> can be appeared at a display of the HTML document in thedisplay space with sizes smaller than that the HTML developer ofdocument has provided. It is possible that a set of images is presentedon the HTML document, of which size is difficult to reduce and increasewithout causing defects of display. Therefore, there is a problem ofdisplay of HTML pages on devices (pocket computer, mobile phones, mediaplayers, etc.) with displays with a low level of resolution of thescreen. Other problem may be a difficulty in printing of HTML documentson the printer.

Use of a system (FIG. 15) of reformatting of HTML documents to correctlydisplay the HTML documents is provided. An initial HTML document enterson an input of a module 1501 to analyze image, which analyzesimages/flash animation contained in the HTML document. The receivedimages is reformatted by the system of reformatting 1503 for change ofthe size/format of images according to control signals 1504. An HTMLlinker 1505 creates a new HTML document with reformatted images. Thereformatted document 1506 is displayed on a corresponding display device1507.

The present general inventive concept can also be embodied ascomputer-readable codes on a computer-readable medium. Thecomputer-readable medium can include a computer-readable recordingmedium and a computer-readable transmission medium. Thecomputer-readable recording medium is any data storage device that canstore data as a program which can be thereafter read by a computersystem. Examples of the computer-readable recording medium includeread-only memory (ROM), random-access memory (RAM), CD-ROMs, magnetictapes, floppy disks, and optical data storage devices. Thecomputer-readable recording medium can also be distributed over networkcoupled computer systems so that the computer-readable code is storedand executed in a distributed fashion. The computer-readabletransmission medium can transmit carrier waves or signals (e.g., wiredor wireless data transmission through the Internet). Also, functionalprograms, codes, and code segments to accomplish the present generalinventive concept can be easily construed by programmers skilled in theart to which the present general inventive concept pertains.

FIGS. 16-23 are views illustrating an image and an adjusted orreformatted image according to the present general inventive concept. Asillustrated in FIGS. 16-23, the adjusted or reformatted images areimproved or compensated by adding or deleting pixels of a path and/or byadjusting (correcting or reducing or increasing) value of thecorresponding pixels disposed adjacent to the added or deleted pixels ofthe path.

As described above, upon receiving an image having a plurality ofpixels, a path is determined according to a characteristic of the image,the image is changed or adjusted by adding or deleting pixels disposedon a path, pixels disposed adjacent to the deleted or added path areadjusted (or weakened), information on the adjusted image is updated,without changing a size, a proportion and a relative position of anobject included in the image.

Although exemplary embodiments of the present general inventive concepthave been illustrated and described, it will be appreciated by thoseskilled in the art that changes may be made in these embodiments withoutdeparting from the principles and spirit of the general inventiveconcept, the scope of which is defined in the appended claims and theirequivalents.

1. A system of adaptive reformatting of digital photos, which comprises a module to select a rule of calculation of function of value for a pixel, a generator of maps of values and history, a module to analyze the map of values and select a path, a module to add a path to an image, a module to remove a path from an image, a scaling module, a module to weaken the map of history, and a module to update the map of values, wherein an output of the module to select a rule of calculation of function of values for a pixel is connected with an input of the generator of maps of values and history, and also with an input of the module to update the map of values, an output of the generator of maps of values and history is connected with an input of the module to analyze the map of values and select a path, an output of the module to analyze the map of values and select a path is connected with inputs of the module to add a path to the image, of the module to remove a path from the image, and of the scaling module, outputs of the module to add a path to the image and of the module to remove a path from the image are connected with an input of the module to weaken the map of history, an output of the module to weaken the map of history is connected with an input of the module to update the map of values, and an output of the module to update the map of values is connected with an input of the module to analyze the map of values and select a path, wherein the module to select a rule of calculation of function of value for a pixel selects a rule of calculation of function of value for each pixel from a set of predetermined rules depending on information contained in the image, wherein the generator of maps of values and history generates an initial map of values and an initial map of history, using the selected rule, wherein the module to analyze the map of values and select a path determines at least one horizontal path from connected pixels, where an initial pixel of a path is on the left border of the image, a final pixel of the path is on the right border of the image, and the quantity of pixels in the path is equal to the width of the image of pixels, and also determines at least one vertical path from connected pixels, where an initial pixel of a path is on the top border of the image, a final pixel of the path is on the bottom border of the image, and the quantity of pixels in a path is equal to the height of the image of pixels, and if a sum of pixel values of all found paths is greater than or equal to a predetermined threshold, the image is transferred to the scaling module, and if the sum is less than the predetermined value, the image and the maps of values and history are transferred to the module to add a path to the image or the module to remove a path from the image depending on a current and required ratio of the sides of the image, wherein the module to add a path to the image increases the current image by adding the least one found path to the image using interpolation for several nearest pixels, wherein the module to remove a path from the image reduces the current image by removing the least one found path from the image, wherein the module to weaken the map of history reduces the values in the map of history, which correspond to environment of pixels of paths removed or added earlier, wherein the module to update the map of value recalculates a map of values, using the previously selected rule and map of history.
 2. A method of adaptive reformatting of digital photos and document images, the method comprising: selecting a rule of calculation of function of value for a pixel depending on results of analyzing an image; generating a map of value and a map of history; changing a size of the image by adding/removing at least one found path by means of interpolation, wherein both of horizontal and vertical paths are used, and the horizontal path is a chain of the connected pixels where an initial pixel of the horizontal path is on the left border of the image, a final pixel of the horizontal path is on the right border of the image, and the quantity of pixels in the horizontal path is equal to the width of the image of pixels, whereas the vertical path is a chain of the connected pixels where an initial pixel of the vertical path is on the top border of the image, a final pixel of the vertical path is on the bottom border of the image, and the quantity of pixels in the vertical path is equal to the height of the image of pixels, and search for the path is executed by means of minimization of a sum of pixel values of the path; and repeating generation of the maps of values and history and change of a size of the image until a demanded size of the image is achieved or the sum of path values exceeds a predetermined threshold.
 3. The method of claim 2, wherein detecting a face image of people is used when the rule of calculation of function of value is selected.
 4. The method of claim 2, wherein a detector of city stages and architectural constructions is used when the rule of calculation of function of value is selected.
 5. The method of claim 2, wherein a high-frequency filter is used when the map of value is generated.
 6. The method of claim 2, wherein a function describing colors typical for human skin is used when the map of value is generated.
 7. The method of claim 2, wherein the changing a size of the image increases the image by adding at least one path to the image, comprising: defining a path with a minimum sum of values; adding new pixels next to pixels of the path using interpolation by several nearest pixels; weakening values in the map of history and updating the map of history; and updating values in the map of values.
 8. The method of claim 2, wherein the changing a size of the image reduces the image by removing at least one path from the image, comprising: defining a path with a minimum sum of values; removing pixels of the path and correcting values of the pixels, thereby bordering with the pixels of the removed path; weakening values in the map of history and updating the map of history; and updating values in the map of value.
 9. The method of claim 2, wherein the weakening values in the map of history uses the following equation: H(i,j)=H(i,j)⁻¹ −C, where H(i,j) denotes a value of element of the map of history, H(i,j)^(−i) denotes a value of element of the map of history before weakening, and C denotes a predetermined constant value.
 10. An image forming apparatus comprising: a module to select a rule of calculation of function of value for a pixel from a set of predetermined rules depending on information contained in an image; a generator to generate an initial map of values and an initial map of history, using the selected rule; a module to search at least one horizontal or vertical path with a minimum sum of values by analyzing the initial map of values; and a module to change a size of the image by adding or removing a path to or from the image using the searched path.
 11. The image forming apparatus of claim 10, wherein the horizontal path is a chain of pixels where an initial pixel is on the left border of the image, a final pixel is on the right border of the image, and the quantity of pixels is equal to the width of the image of pixels, wherein the vertical path is a chain of pixels where an initial pixel is on the top border of the image, a final pixel is on the bottom border of the image, and the quantity of pixels is equal to the height of the image of pixels.
 12. The image forming apparatus of claim 10, further comprising: a module to scale the image if a sum of pixel values of the paths is greater than or equal to a predetermined threshold.
 13. The image forming apparatus of claim 10, wherein the module to change a size of the image comprises: a module to add the searched path to the image; and a module to remove the searched path from the image.
 14. The image forming apparatus of claim 13, wherein the module to add the searched path adds at least one path by adding new pixels next to pixels of the searched path using interpolation by several nearest pixels, by weakening values in the map of history and updating the map of history, and updating values in the map of values.
 15. The image forming apparatus of claim 13, wherein the module to remove the searched path removes at least one path by defining a path with a minimum sum of values, removing pixels of the path and correcting values of the pixels, thereby bordering with the pixels of the removed path, weakening values in the map of history and updating the map of history, and updating values in the map of value.
 16. The image forming apparatus of claim 10, wherein the module to select a rule of calculation of function of value uses detecting a face image of people.
 17. The image forming apparatus of claim 10, wherein the module to select a rule of calculation of function of value uses detecting city stages and architectural constructions.
 18. The image forming apparatus of claim 10, wherein the generator uses a high frequency filter.
 19. The image forming apparatus of claim 10, wherein the generator uses a function describing colors typical for human skin.
 20. An image forming apparatus using the system claimed in claim
 1. 21. An image forming apparatus using the method claimed in claim
 2. 